package com.ag.lzm.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ag.bean.TbEvent;
import com.ag.bean.TbPlan;
import com.ag.lzm.dao.BaseDAO;
import com.ag.lzm.service.IPlanStandardService;

@Service("LZMPlanStandardServiceImpl")
public class PlanStandardServiceImpl implements IPlanStandardService {

	// @Resource(name = "LZMTbEventDAO")
	// private TbEventDAO eventDAO;
	//	
	// @Resource(name = "LZMTbPlanDAO")
	// private TbPlanDAO planDAO;

	@Resource(name = "LZMBaseDAO")
	private BaseDAO baseDAO;

	@Override
	public List<TbPlan> matchPlan(String eventID) {
//		String queryString = "from TbEvent e join fetch e.tbEventLevel where e.EId = ?";
//		List list = baseDAO.find(queryString, eventID);
//		//return null;
//		if (list.size()==0) {
//			return null;
//		}
//		TbEvent event = (TbEvent) list.get(0);
//		StringBuilder sb = new StringBuilder();
//		sb.append("select ps.tbPlan from TbPlanStandard ps where 1 = 1");
//		if (event.getTbEventLevel().getC()!=null) {
//			sb.append(" or ps.elId = '");
//			sb.append(event.getTbEventLevel().getC());
//			sb.append("'");
//		}
//		if (event.getEDeaths() != null) {
//			sb.append(" or ps.EDeaths = ");
//			sb.append(event.getEDeaths());
//		}
//		if (event.getEInjuries() != null) {
//			sb.append(" or ps.PPoisoning = ");
//			sb.append(event.getEInjuries());
//		}
//	    //System.out.println("123aaa"+sb.toString());
//		return baseDAO.find(sb.toString());
		String queryString = "from TbPlan";
		return baseDAO.find(queryString);
	}

}
